

import React from 'react'

// 传入一个组件。返回一个包装后的组件
// value onChange

const HocInput = (WrapperInput:any) => {
  return class HocInput extends React.Component {
    state:any = {
      inputValue: ''
    }
    hanleChangeValue = (e:any) => {
      let targetValue = e.target.value;
      this.setState({
        inputValue: targetValue
      })
    }
    render() {
      console.log('WrapperInput:', WrapperInput)
      return  <WrapperInput
      value={this.state.value} onChange={this.hanleChangeValue} />
    }
  }
}

export default HocInput;


